var express = require('express');
var router = express.Router();

const { getUsers, deleteUsersById, addUsers } = require("../server/usersServer.js")

// 获取用户
router.get('/', async (req, res, next) => {
  const data = await getUsers()
  res.send(data)
});
// 删除用户
router.post('/deleteUsersById', async (req, res) => {
  res.send(await deleteUsersById(req.body));
});
// 新增用户
router.post('/addUsers', async (req, res, next) => {
  const data = await addUsers(req.body)
  res.send(data)
});

module.exports = router;
